package cn.itsource.controller;

import cn.itsource.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/json2")
public class UserController {
    @Autowired
    private User user;
    @RequestMapping("/01")
    public String test(){
        return "1111111111";
    }

    @RequestMapping("/02")
    public User test2(){
        return new User(1L,"古巨基");
    }

    @RequestMapping("/03")
    public List<User> test3(){
        List<User> users = Arrays.asList(new User(1L, "张学友"), new User(2L, "林志玲"));
        return users;
    }

    @RequestMapping("/04")
    public Map<String,Object> test4(){
        Map<String,Object> map = new HashMap<>();
        map.put("success","true" );
        map.put("msg","发射成功！" );
        return map;
    }
}
